package com.book.service.serviceImpl;

import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.book.entity.Cart;
import com.book.mapper.CartMapper;
import com.book.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CartServiceImpl extends ServiceImpl<CartMapper,Cart> implements CartService {
    @Autowired
    private CartMapper cartMapper;

    @Override
    public List<Cart> getCartsByUId(String uId) {
        Wrapper<Cart> con=new Condition();
        con.eq("u_id",uId);
        return selectList(con);
    }

    @Override
    public Map<String, Object> statistics(String uId) {
        return cartMapper.statistics(uId);
    }
}
